package gold.digger;

/**
 * Created by fanzhenyu02 on 2020/6/27.
 * common problem solver template.
 */
public class LC392 {


    public boolean isSubsequence(String s, String t) {
        if (s == null || s.length() <= 0) {
            return true;
        }

        int j = 0, count = 0;
        for (int i = 0; i < t.length(); ++i) {
            if (j >= s.length()) {
                break;
            }

            if (t.charAt(i) == s.charAt(j)) {
                ++j;
                ++count;
            }
        }

        return count == s.length();
    }


    public static void main(String[] args) {
        String test = "abbbbacd";
        LC392 an = new LC392();
        System.out.println(an.isSubsequence(test, ""));
    }
}
